<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

include('config.php');
//require_once(mnminclude . 'login.php');
require_once(mnminclude . 'html1.php');
//require_once(mnminclude . 'link.php');
global $db;
$user = $db->get_row("SELECT * FROM " . table_users . " WHERE user_login = 'winight'");

if ($user->user_id > 0)
{
    
    $current_user->user_login = $user->user_login;    
    $current_user->user_id = $user->user_id;
    $current_user->authenticated = TRUE;
    $current_user->md5_pass = md5($user->user_pass);

    $domain = preg_replace('/^www/', '', $_SERVER['HTTP_HOST']);

    if ($domain == 'localhost' || strpos($domain, 'localhost:') === 0)
        $domain = '';
   
    $strCookie = base64_encode(join(':',
                            array(
                                $current_user->user_login,
                                md5($current_user->user_login),
                                $current_user->md5_pass)
                    )
    );
    
    $time = time() + 315360000; // Lo dejamos v�idos por 1000 horas
                
    setcookie("mnm_user", $current_user->user_login, $time, "/", $domain);
    setcookie("mnm_key", $strCookie, $time, "/", $domain);
}

?>
